<?php
/**
 * desc Created by wang.
 * User: wang
 * motto: 是时候为小时候吹过的牛而努力了!
 * Date: 2020/3/23 16:10
 */

namespace app\admin\validate;


use think\Validate;

class Auth extends Validate
{
    protected $rule = [
        'pid' => 'require|number',
        'title' => 'require',
        'name' => 'require',
        'type' => ['require', 'in'=>'0,1'],
        'id' => 'require|integer',
        'value' => 'integer',
    ];

    protected $message = [
        'pid.require' => '父菜单不能为空',
        'pid.number' => '父菜单类型错误',
        'title.require' => '菜单名称不能为空',
        'name.require' => '菜单节点不能为空',
        'type.require' => '是否显示不能为空',
        'type.min' => '是否显示类型值有误',
        'id.require' => 'ID不能为空',
        'id.integer' => 'ID类型值有误',
        'value.integer' => 'value必须为整数',
    ];

    //需要校验的场景
    protected $scene = [
        'add' => ['pid', 'title', 'name', 'type'],
        'edit' => ['title', 'name', 'type'],
        'upSort' => ['id', 'value'],
        'del' => ['id'],
    ];
}